package com.hoas.quickstart.threads.chapter02.chapter02_2_14_01;

public class OutClass {

    static class Inner {

        public void method1() {

            synchronized (" 其他的锁 ") {

                for (int i = 1; i <= 10; i++) {
                    System.out.println(Thread.currentThread().getName() + " i=" + i);

                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

            }

        }

        public synchronized void method2() {
            for (int i =1 ; i <= 10 ; i++) {
                System.out.println(Thread.currentThread().getName() + " i=" + i);

                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }

    }

}
